<?php

namespace app\admin\model\wwh;

use think\Model;

class Development extends Model
{
    // 表名
    protected $name = 'wwh_development';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'lang_text'
    ];

    public function getLangList()
    {
        return ['1' => __('Lang 1'), '2' => __('Lang 2')];
    }

    public function getLangTextAttr($value, $data)
    {
        $value = $value ?: ($data['lang'] ?? '');
        $list = $this->getLangList();
        return $list[$value] ?? '';
    }
}
